<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('nodes', function (Blueprint $table) {
            $table->id();
            $table->integer('pid')->default(0)->comment('父节点id');
            $table->string('name')->comment('节点名称');
            $table->string('path')->comment('节点路径');
            $table->string('icon')->default('')->comment('节点图标');
            $table->string('method')->comment('节点请求方法');
            $table->tinyInteger('status')->default(1)->comment('节点状态');
            $table->tinyInteger('is_menu')->default(1)->comment('是否是菜单');
            $table->float('sort')->comment('排序');
            $table->string('params')->default('')->comment('节点参数');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('nodes');
    }
};
